
// TestAWT4MFCView.cpp : implementation of the CTestAWT4MFCView class
//

#include "stdafx.h"
#include "TestAWT4MFC.h"

#include "TestAWT4MFCDoc.h"
#include "TestAWT4MFCView.h"
#include "HelloApplet.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CTestAWT4MFCView

IMPLEMENT_DYNCREATE(CTestAWT4MFCView, AWTView)

BEGIN_MESSAGE_MAP(CTestAWT4MFCView, AWTView)
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, &AWTView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, &AWTView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CTestAWT4MFCView::OnFilePrintPreview)
END_MESSAGE_MAP()

// CTestAWT4MFCView construction/destruction

CTestAWT4MFCView::CTestAWT4MFCView()
{
	// TODO: add construction code here

}

CTestAWT4MFCView::~CTestAWT4MFCView()
{
}

BOOL CTestAWT4MFCView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	m_applet = new HelloApplet(this);

	return AWTView::PreCreateWindow(cs);
}

// CTestAWT4MFCView drawing

void CTestAWT4MFCView::OnDraw(CDC* /*pDC*/)
{
	CTestAWT4MFCDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: add draw code for native data here
}


// CTestAWT4MFCView printing


void CTestAWT4MFCView::OnFilePrintPreview()
{
	AFXPrintPreview(this);
}

BOOL CTestAWT4MFCView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CTestAWT4MFCView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CTestAWT4MFCView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

void CTestAWT4MFCView::OnRButtonUp(UINT nFlags, CPoint point)
{
	ClientToScreen(&point);
	OnContextMenu(this, point);
}

void CTestAWT4MFCView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
}


// CTestAWT4MFCView diagnostics

#ifdef _DEBUG
void CTestAWT4MFCView::AssertValid() const
{
	AWTView::AssertValid();
}

void CTestAWT4MFCView::Dump(CDumpContext& dc) const
{
	AWTView::Dump(dc);
}

CTestAWT4MFCDoc* CTestAWT4MFCView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestAWT4MFCDoc)));
	return (CTestAWT4MFCDoc*)m_pDocument;
}
#endif //_DEBUG


// CTestAWT4MFCView message handlers
